package com.zzx.controller;

import com.zzx.entity.ApiResult;
import com.zzx.entity.TUserMenu;
import com.zzx.service.TUserMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "员工-菜单 模块管理")
@RestController
@RequestMapping("/TEmployeeMenu")
public class TUserMenuController {

    @Resource
    private TUserMenuService tUserMenuService;

    @ApiOperation(value = "新增、编辑")
    @RequestMapping(value="/add",method = RequestMethod.POST)
    public ApiResult add(@RequestBody TUserMenu param) {
        tUserMenuService.add(param);
        return ApiResult.ok();
    }
    @ApiOperation(value = "批量-新增、编辑")
    @RequestMapping(value="/addList",method = RequestMethod.POST)
    public ApiResult addList(@RequestBody List<TUserMenu> param) {
        tUserMenuService.addList(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "删除")
    @RequestMapping(value="/deleteById",method = RequestMethod.POST)
    public ApiResult deleteById(@RequestBody TUserMenu param) {
        tUserMenuService.deleteById(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "列表查询")
    @RequestMapping(value="/selectBy",method = RequestMethod.POST)
    public ApiResult selectBy(@RequestBody TUserMenu param) {

        return ApiResult.ok(tUserMenuService.selectBy(param));
    }
}
